package com.sumainfor.pc.market.service.gmio;

import com.sumainfor.common.util.JsonResult;
import com.sumainfor.pc.market.dao.gmio.GmioSearchMapper;
import org.apache.commons.collections.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务管家工作台搜索
 * <p>
 *
 * @author: Mr.Wang
 * @create: 2019-08-05 18:32
 **/
@Service
public class GmioSearchService {

   @Autowired
    GmioSearchMapper gmioSearchMapper;

    /**
     * 根据租客姓名或电话查询租客信息
     * @author zhoucong
     * @data 2019/8/5
     * @Param
     * @return
     */
    public List<Map<String,Object>> getTenByPhone(String search){
        return gmioSearchMapper.getTenByPhone(search);
    }

    /**
     * 根据项目编号，项目名称，房源编号获取训房列表
     * @author zhoucong
     * @data 2019/9/19
     * @Param
     * @return
     */
    public List<Map<String,Object>> getFugjTrainingList(String search){
        List<Map<String,Object>> getFugjTrainingList = gmioSearchMapper.getFugjTrainingList(search);
        if (getFugjTrainingList.size()>0){
            for (Map<String,Object> map:getFugjTrainingList) {
                if (MapUtils.getInteger(map,"PatStatus")==0){
                    map.put("PatStatusOne","未巡房");
                }
                if (MapUtils.getInteger(map,"PatStatus")==1){
                    map.put("PatStatusOne","未通过");
                }else{
                    map.put("PatStatusOne","已巡房");
                }

            }
        }
        return getFugjTrainingList;
    }


    /**
     * 根据项目编号，项目名称，楼号，室号 获取房源集合
     * @author zhoucong
     * @data 2019/9/20
     * @Param
     * @return
     */
    public List<Map<String,Object>> getFumsHouInfoList(String search){
        return gmioSearchMapper.getFumsHouInfoList(search);
    }

    /**
     * 根据项目编号，项目名称，楼号，室号 获取房源详情
     * @author zhoucong
     * @data 2019/9/20
     * @Param
     * @return
     */
    public List<Map<String,Object>> getZhzgHouIdList(String search){
        return gmioSearchMapper.getZhzgHouIdList(search);
    }


    /**
     * 根据业主联系方式获取业主信息
     * @author zhoucong
     * @data 2019/9/20
     * @Param
     * @return
     */
    public List<Map<String,Object>> YyzlOwnerList(String search){
        return gmioSearchMapper.YyzlOwnerList(search);
    }
}
